<template>
  <div class="body" @click="clickToPageFunc">
    <a class="card credentialing">
      <div class="overlay"></div>
      <div class="circle">
        <img :src="imgUrl" style="z-index: 100; width: 56px" alt="" />
      </div>
      <p>{{ cardTitle }}</p>
      <!-- <p>合格标准</p> -->
    </a>
  </div>
</template>

<script lang="ts">
  import {defineComponent} from 'vue'
  export default defineComponent({
    name: 'itemCard'
  })
</script>
<script lang="ts" setup>
  // 引入
  import useGlobalAPI from '@/hooks/useGlobalAPI'
  const {router} = useGlobalAPI()
  // 接收props
  const props = defineProps({
    cardTitle: String,
    imgUrl: String,
    toPagePath: String
  })

  // 卡片的点击跳转事件函数
  const clickToPageFunc = () => {
    console.log(props.toPagePath)

    router.push({
      path: props.toPagePath
    })
  }
</script>

<style lang="less" scoped>
  .credentialing {
    --bg-color: #37a4f8;
    --bg-color-light: #3dbcfb;
    --text-color-hover: #4c5656;
    --box-shadow-color: rgba(220, 233, 255, 0.48);
  }

  .card {
    width: 260px;
    height: 200px;
    background: #fff;
    border-top-right-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    box-shadow: 0 14px 26px rgba(0, 0, 0, 0.04);
    transition: all 0.3s ease-out;
    text-decoration: none;
    border-radius: 20px;
  }

  .card:hover {
    transform: translateY(-5px) scale(1.005) translateZ(0);
    box-shadow: 0 24px 36px rgba(0, 0, 0, 0.11), 0 24px 46px var(--box-shadow-color);
  }

  .card:hover .overlay {
    color: white;
    transform: scale(4) translateZ(0);
  }

  .card:hover .circle {
    border-color: var(--bg-color-light);
    background: var(--bg-color);
  }

  .card:hover .circle:after {
    background: var(--bg-color-light);
  }

  .card:hover p {
    color: white !important;
    // color: var(--text-color-hover);
  }

  .card:active {
    transform: scale(1) translateZ(0);
    box-shadow: 0 15px 24px rgba(0, 0, 0, 0.11), 0 15px 24px var(--box-shadow-color);
  }

  .card p {
    font-size: 18px;
    color: #4c5656;
    margin-top: 15px;
    z-index: 1000;
    transition: color 0.3s ease-out;
    letter-spacing: 2px;
    font-weight: bold;
  }

  .circle {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: #fff;
    border: 20px solid var(--bg-color);
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    z-index: 1;
    transition: all 0.3s ease-out;
  }

  .circle:after {
    content: '';
    width: 100px;
    height: 100px;
    display: block;
    position: absolute;
    background: var(--bg-color);
    border-radius: 50%;
    transition: opacity 0.3s ease-out;
  }

  .circle svg {
    z-index: 10000;
    transform: translateZ(0);
  }

  .overlay {
    width: 95px;
    position: absolute;
    height: 95px;
    border-radius: 50%;
    background: var(--bg-color);
    top: 35px;
    left: 83px;
    z-index: 0;
    transition: transform 0.3s ease-out;
  }
</style>
